<template>
  <el-container class="adminHomeContainer">
    <el-header>
      <div class="headerDiv">
        <img class="logo" src="../../assets/sise.png" alt="">
        <div class="headerSpan"><h5>高校社团管理系统</h5></div>
      </div>
      <div class="userName">欢迎，{{ userName }}</div>
<!--      <el-button type="info" @click="dialogVisible = true">退出</el-button>-->
      <el-button type="info" @click="logout">退出</el-button>

    </el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu
          default-active="/managerHome/manageWelcome"
          class="el-menu-vertical-demo"
          router
        >
          <el-menu-item index="/managerHome/manageWelcome">
            <i class="el-icon-menu"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-tickets"></i>
              <span>我的活动</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/managerHome/myActivity">我的活动</el-menu-item>
              <el-menu-item index="/managerHome/canJoinActivityList">可加入活动列表</el-menu-item>
<!--              <el-menu-item index="/managerHome/applyJoinActivityList">申请活动列表</el-menu-item>-->
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-office-building"></i>
              <span>我的社团</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/managerHome/myClub">我的社团</el-menu-item>
              <el-menu-item index="/managerHome/canJoinClubList">可加入社团列表</el-menu-item>
              <el-menu-item index="/managerHome/applyJoinClubList">申请加入社团列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-office-building"></i>
              <span>社团管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/managerHome/addClub">社团申请</el-menu-item>
              <el-menu-item index="/managerHome/clubManage">社团管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-menu-item index="/managerHome/myAccount">
            <i class="el-icon-menu"></i>
            <span slot="title">我的账号</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
<!--    登出确认-->
<!--    <el-dialog-->
<!--      title=""-->
<!--      :visible.sync="dialogVisible"-->
<!--      width="30%"-->
<!--      :before-close="handleClose">-->
<!--      <span>这是一段信息</span>-->
<!--      <span slot="footer" class="dialog-footer">-->
<!--    <el-button @click="dialogVisible = false">取 消</el-button>-->
<!--    <el-button type="primary" @click="logout">确 定</el-button>-->
<!--  </span>-->
<!--    </el-dialog>-->
  </el-container>
</template>

<script>
import {getPageActivity} from "../../api/activity";
import {getStudentUserName} from "../../api/login";

export default {
  name: 'ManagerHome',
  data() {
    return {
      userName: '',
      dialogVisible: false
    }
  },
  created() {
    this.getUserName()
  },
  methods: {
    logout() {
      window.sessionStorage.removeItem('Authorization')
      this.$router.push('/adminLogin')
    },
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done();
        })
        .catch(_ => {});
    },
    getUserName() {
      getStudentUserName().then(res => {
        console.log(res.data)
        this.userName = res.data;
      })
    }
  }
}
</script>

<style Lang="less" scoped>

.adminHomeContainer {
  height: 100%;
}

.el-header {
  background-color: #f7fafc;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  align-items: center;
  color: #1a1919;
  font-size: 20px;

}

.headerDiv {
  display: flex;
  align-items: center;

}

.userName {
  //flex: 1;
  width: 150px;
  text-align: right;
  margin-left: 600px;
  font-size: small;
  color: #175199;
}

.headerSpan {
  width: 300px;
  margin-left: 15px;
  //font-size: 15px;
}

.el-aside {
  background-color: #e6eaee;
}

.logo {
  height: 56px;
  width: 219px;
}


</style>
